﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;
using System.Data;
using EazyCMS.Common;

namespace EazyCMS.Web.Plugin.Naire
{
    public partial class vote_show : Web.UI.BasePage
    {
        protected int id;
        protected Model.naire model = new Model.naire();
        protected Model.vote model2 = new Model.vote();
        protected int page; //当前页码
        protected int totalcount; //OUT数据总数
        protected int jj = 0;
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            id = EazyRequest.GetQueryInt("id");
            page = EazyRequest.GetQueryInt("page", 1);
            BLL.naire bll = new BLL.naire();
            
            if (!bll.Exists(id))
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦，您要浏览的页面不存在或已删除！")));
                return;
            }
            model = bll.GetModel(id);
            
        }
        public Model.vote get_list(int idd)
        {
            BLL.vote bll2 = new BLL.vote();
            return bll2.GetModel(idd);
        }
        public DataTable get_list(int page_size, int page_index, string strwhere, out int totalcount)
        {
            DataTable dt = new DataTable();
            string _where = "0=0 and naire_id=" + model.id;
            if (!string.IsNullOrEmpty(strwhere))
            {
                _where += " and " + strwhere;
            }
            dt = new BLL.vote().GetList(page_size, page_index, _where, "sort_id asc,add_time desc", out totalcount).Tables[0];
            jj = dt.Rows.Count;
            return dt;
        }
    }
}
